//
//  TipsTableViewCell.m
//  Cooking
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 ZP.Y. All rights reserved.
//

#import "TipsTableViewCell.h"
#import "AppMacro.h"
#import "TipsView.h"
#import "TipsFirstPageModel.h"
#import "UIImageView+WebCache.h"

@interface TipsTableViewCell()

@property (retain, nonatomic) TipsView *tipsView;

@end

@implementation TipsTableViewCell

- (void)dealloc {
    [_tipsView release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.tipsView = [[TipsView alloc] init];
        _tipsView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_tipsView];
        [_tipsView release];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    if ([UIScreen mainScreen].bounds.size.height == 667) {
        _tipsView.frame = CGRectMake(0, 0, WIDTH, 125);
    } else if ([UIScreen mainScreen].bounds.size.height == 568) {
        _tipsView.frame = CGRectMake(0, 0, WIDTH, 110);
    } else if ([UIScreen mainScreen].bounds.size.height == 736) {
        _tipsView.frame = CGRectMake(0, 0, WIDTH, 125);
    } else {
        _tipsView.frame = CGRectMake(0, 0, WIDTH, 110);
    }
}

- (void)sendValueWithModel:(TipsFirstPageModel *)firstPagemodel {
    _tipsView.titleLabel.text = firstPagemodel.name;
    _tipsView.introduceLabel.text = firstPagemodel.content;
    [_tipsView.rightView sd_setImageWithURL:[NSURL URLWithString:firstPagemodel.titleImageFile] placeholderImage:[UIImage imageNamed:@"zhanwei_02.png"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
